package com.example.administrator.testc.DBs;/**
 * Created by Administrator on 2016/5/26.
 */

import android.content.ContentValues;
import android.util.Log;

/**
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>类描述
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>属性描述
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>方法描述
 */
public class AdvertisingBean {

    /**
     * clickUrl : http://m.xincheping.com/ //点击的url
     * file : http://file.xincheping.com/201606/89/a4ec7081bd4752914822b8d3d4d841.jpg //素材的url
     * positionId : 256 //位置id
     * width : 1080 //素材宽度
     * id : 2199 //广告id
     * pubDates : 2016-06-01,2016-06-02,2016-06-03,2016-06-04,2016-06-05,2016-06-06 //发布日期
     * pageId : 25 //位置所在页面id
     * height : 1476 //素材高度
     */

    public enum EAdvertising{
        TABEL_NAME("advertisingTable", 0), clickUrl("clickUrl", 1), file("file", 2),
        positionId("positionId", 3), width("width", 4), id("id", 5), pubDates("pubDates", 6)
        ,pageId("pageId", 7), height("height", 8);

        private String value;
        private int index;

        EAdvertising(String value, int index) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        public int getIndex() {
            return index;
        }

        public static ContentValues getContentValues(AdvertisingBean bean){
            ContentValues contentValues = new ContentValues();
            for (EAdvertising e : EAdvertising.values())
                switch (e.name()){
                    case "TABEL_NAME":
                        break;
                    case "clickUrl":
                        if(bean.getClickUrl() != null)
                            contentValues.put(AdvertisingBean.EAdvertising.clickUrl.name(), bean.getClickUrl());
                        break;
                    case "file":
                        if(bean.getFile() != null)
                            contentValues.put(AdvertisingBean.EAdvertising.file.name(), bean.getFile());
                        break;
                    case "positionId":
                        if(bean.getPageId() != -1)
                            contentValues.put(AdvertisingBean.EAdvertising.positionId.name(), bean.getPositionId());
                        break;
                    case "width":
                        if(bean.getWidth() != -1)
                            contentValues.put(AdvertisingBean.EAdvertising.width.name(), bean.getWidth());
                        break;
                    case "id":
                        if(bean.getId() != -1)
                            contentValues.put(AdvertisingBean.EAdvertising.id.name(), bean.getId());
                        break;
                    case "pubDates":
                        if(bean.getPubDates() != null)
                            contentValues.put(AdvertisingBean.EAdvertising.pubDates.name(), bean.getPubDates());
                        break;
                    case "pageId":
                        if(bean.getPageId() != -1)
                            contentValues.put(EAdvertising.pageId.name(), bean.getPageId());
                        break;
                    case "height":
                        if(bean.getHeight() != -1)
                            contentValues.put(AdvertisingBean.EAdvertising.height.name(), bean.getHeight());
                        break;
                    default:
                        break;
                }
            return contentValues;
        }

        private void showError(String value){
            Log.i("TAGSS-" + getClass().toString(), value + " throw error");
        }
    }

    private String clickUrl;
    private String file;
    private int positionId;
    private int width;
    private int id;
    private String pubDates;
    private int pageId;
    private int height;

    public String getClickUrl() {
        return clickUrl;
    }

    public void setClickUrl(String clickUrl) {
        this.clickUrl = clickUrl;
    }

    public String getFile() {
        return file;
    }

    public void setFile(String file) {
        this.file = file;
    }

    public int getPositionId() {
        return positionId;
    }

    public void setPositionId(int positionId) {
        this.positionId = positionId;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPubDates() {
        return pubDates;
    }

    public void setPubDates(String pubDates) {
        this.pubDates = pubDates;
    }

    public int getPageId() {
        return pageId;
    }

    public void setPageId(int pageId) {
        this.pageId = pageId;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}
